home *** CD-ROM | disk | FTP | other *** search
/ 3D GFX / 3D GFX.iso / amiutils / e_h / gifadpro / gifpluscomment next >
Text File  |  1995-12-30  |  3KB  |  117 lines

  1. /* $VER: GIF_+_Comment 1.06 (21.5.95)⌐ Felix C. Coronado
  2. */
  3. ADDRESS "ADPro"
  4. OPTIONS RESULTS
  5.  
  6. /*Change these values to control the size of the "Searching for comments"
  7.   window*/
  8. SrchOutWinX=275
  9. SrchOutWinY=90
  10.  
  11. /*Change these values to control the size of the "Display comments" window*/
  12. ComOutWinX=640
  13. ComOutWinY=198
  14.  
  15. /*If you are low on memory, you might want to make this smaller, but it
  16.   should stay in the range of 3 - 65535*/
  17. BlockSize=65535
  18.  
  19. NL='0A'x
  20. ADPRO_TO_FRONT
  21. GETFILE '"Load GIF File"'
  22. IF rc=10 THEN EXIT
  23. ELSE DO
  24.  FullFileName=ADPro_Result
  25.  zz=LASTPOS('/',FullFileName)
  26.  IF zz=0 THEN zz=INDEX(FullFileName,':')
  27.  FileDir=LEFT(FullFileName,zz)
  28.  FileName=RIGHT(FullFileName,LENGTH(FullFileName)-zz)
  29.  IF FileDir~='/' & RIGHT(FileDir,2)~='//' & RIGHT(FileDir,1)='/' THEN FileDir=LEFT(FileDir,LENGTH(FileDir)-1)
  30.  IF OPEN(File,FullFileName,R) THEN DO
  31.   Type=READCH(File,6)
  32.   IF Type~='GIF87a' & Type~='GIF89a' THEN DO
  33.    ADPRO_TO_FRONT
  34.    OKAY1 'Error During Load'||NL||,
  35.          'Not A GIF File'
  36.    EXIT
  37.   END
  38.   Comment=''
  39.   IF Type='GIF89a' THEN DO
  40.    SET_ADPRO_PUBLIC
  41.    ADProScrn=adpro_result
  42.    SET_ADPRO_MODE
  43.    ScreenWidth=WORD(ADPRO_RESULT,2)
  44.    ScreenHeight=WORD(ADPRO_RESULT,3)
  45.    IF OPEN(CON,'con:'||TRUNC((ScreenWidth-SrchOutWinX)/2)||'/'||TRUNC((ScreenHeight-SrchOutWinY)/2)||'/'||SrchOutWinX||'/'||SrchOutWinY||'/ADPro GIF_+_Comment Loader/NOSIZE/SCREEN '||ADProScrn,'W') THEN DO
  46.     CALL WRITECH(CON,'1B5B316D'x||'File: '||'1B5B306D'x||FileName||NL||,
  47.                       NL||,
  48.                      'Searching for comments...'||NL||,
  49.                       NL||,
  50.                      'Ctrl-d to stop')
  51.     SIGNAL ON BREAK_D
  52.     BlockNum=0
  53.     SearchVar=''
  54.     ComNum=0
  55.     StartPos=SEEK(File,0,'C')
  56.     DO WHILE ~EOF(File)
  57.      BlockNum=BlockNum+1
  58.      SearchVar=RIGHT(SearchVar,2)||READCH(File,BlockSize-2)
  59.      IF INDEX(SearchVar,'0021FE'x)~=0 THEN DO
  60.       ComNum=ComNum+1
  61.       ComLengthPos=StartPos+(BlockNum-1)*(BlockSize-2)+INDEX(SearchVar,'0021FE'x)
  62.       CALL SEEK(File,ComLengthPos,'B')
  63.       ComLength=C2D(READCH(File,1))
  64.       Comment=Comment||NL||,
  65.                NL||,
  66.               '1B5B316D'x||'Comment '||ComNum||':'||'1B5B306D'x||NL||,
  67.                STRIP(COMPRESS(READCH(File,ComLength),'0D'x),'L','0A'x)
  68.       ComLength=C2D(READCH(File,1))
  69.       DO WHILE ComLength~=0 & ~EOF(File)
  70.        Comment=Comment||COMPRESS(READCH(File,ComLength),'0D'x)
  71.        ComLength=C2D(READCH(File,1))
  72.       END
  73.       Comment=STRIP(Comment,'T','0A'x)
  74.       BlockNum=0
  75.       SearchVar=''
  76.       StartPos=SEEK(File,-1,'C')
  77.      END
  78.     END
  79.     SIGNAL OFF BREAK_D
  80.    END
  81.   END
  82.  END
  83.  ELSE DO
  84.   ADPRO_TO_FRONT
  85.   OKAY1 'Error opening file'||NL||,
  86.         '"'||FullFileName||'"'
  87.   EXIT
  88.  END
  89. END
  90.  
  91. BREAK_D:
  92. SearchVar=''
  93. CALL CLOSE(File)
  94. CALL CLOSE(CON)
  95. IF Comment~='' THEN DO
  96.  ADPRO_TO_FRONT
  97.  IF OPEN(CON,'con:'||TRUNC((ScreenWidth-ComOutWinX)/2)||'/'||TRUNC((ScreenHeight-ComOutWinY)/2)||'/'||ComOutWinX||'/'||ComOutWinY||'/ADPro GIF_+_Comment Loader/CLOSE/WAIT/SCREEN '||ADProScrn,'W') THEN DO
  98.   CALL WRITECH(CON,'1B5B316D'x||'File: '||'1B5B306D'x||FullFileName||,
  99.                     Comment)
  100.   CALL CLOSE(CON)
  101.  END
  102. END
  103. LFORMAT 'GIF'
  104. IF rc=10 THEN DO
  105.  ADPRO_TO_FRONT
  106.  OKAY1 'Error: Loader not found'||NL||,
  107.        '"Loaders2/GIF"'
  108.  EXIT
  109. END
  110. LOAD '"'FullFileName'"'
  111. IF rc=10 THEN DO
  112.  ADPRO_TO_FRONT
  113.  OKAY1 'Error loading file'||NL||,
  114.        '"'||FullFileName||'"'
  115. END
  116. LFORMAT 'GIF_+_Comment'
  117.